﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>테이블의 짝수번째 배경색 변경</title>

    <style type="text/css">

        .redColor { background-color: Red; }

        .blueColor { background-color:Green; }

    </style>

 

    <script src="jquery-1.6.2.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(


            function() {
     for(var i=0;i<4;i++){
            	
	$('tr:eq('+i+') td:odd').addClass("redColor");
	 
	$('tr:eq('+i+') td:even').addClass("blueColor");
	
	
     }
	
	 
            }

        );

    </script>

</head>

 

<body>

  <table width="100">

  <tr >

        <td></td><td></td><td></td><td></td><td></td>

  </tr>

  <tr>

        <td></td><td></td><td></td><td></td><td></td>

  </tr>

  <tr>

        <td></td><td></td><td></td><td></td><td></td>

  </tr>

  <tr>
        <td></td><td></td><td></td><td></td><td></td>
       
  </tr>
 
  </table>

</body>

</html>



